<template>
  <div>
    <el-page-header @back="goBack"></el-page-header>
    <div class="wrapper">
      <div>
        <div class="toplist">
          <div
            class="item"
            v-for="(item, idx) of cList"
            :key="idx"
            @click="goChannelTransfer(item.keyUrl)"
          >
            <div class="tit">{{ item.tit }}</div>
            <div class="img">
              <img :src="require(`@/assets/imgs${item.url}.png`)" alt="" />
            </div>
          </div>
        </div>
        <div class="btmlink">
          <div>
            同时向多个收款账户进行转账操作，可使用批量企业付款功能。点击
            <span class="batchlink" @click="goBatchTransfer"
              >创建批量企业付款</span
            >
            ，开始付款。
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import base64 from "@/utils/code";

export default {
  name: "enterprisePayment",
  components: {},
  data() {
    return {
      channelInfo: {},
      cList: [
        {
          tit: "转账到余额",
          url: "/checkAccount/icon_cash",
          keyUrl: "transfer_reset",
        },
        {
          tit: "转账到微信",
          url: "/checkAccount/icon_wechat",
          keyUrl: "transfer_wechat",
        },
        {
          tit: "转账到支付宝",
          url: "/checkAccount/icon_Alipay",
          keyUrl: "transfer_ali",
        },
        // {
        //   tit: "转账到银行卡",
        //   url: "/checkAccount/icon_bankcard",
        //   keyUrl: "transfer_bankcard",
        // },
      ],
    };
  },
  created() {
    const item = JSON.parse(base64.decode(this.$route.query.item));
    let channel = item.channel;
    if (channel) {
      switch (channel) {
        case "ada":
          this.cList = [
            {
              tit: "转账到余额",
              url: "/checkAccount/icon_cash",
              keyUrl: "transfer_reset",
            },
            // {
            //   tit: "转账到银行卡",
            //   url: "/checkAccount/icon_bankcard",
            //   keyUrl: "transfer_bankcard",
            // },
          ];
          break;
        case "wechat":
          this.cList = [
            {
              tit: "转账到微信",
              url: "/checkAccount/icon_wechat",
              keyUrl: "transfer_wechat",
            },
            // {
            //   tit: "转账到银行卡",
            //   url: "/checkAccount/icon_bankcard",
            //   keyUrl: "transfer_bankcard",
            // },
          ];
          break;
        case "ali":
          this.cList = [
            {
              tit: "转账到支付宝",
              url: "/checkAccount/icon_Alipay",
              keyUrl: "transfer_ali",
            },
            // {
            //   tit: "转账到银行卡",
            //   url: "/checkAccount/icon_bankcard",
            //   keyUrl: "transfer_bankcard",
            // },
          ];
          break;
      }
    }
    this.channelInfo = item;
  },
  watch: {
    "$store.state.testLine": {
      handler(val) {
        if(this.$route.name==this.$options.name){
          if (val) {
            this.$store.commit("changeTestMode", true);
          }
        }
      },
    },
    deep: true,
  },
  methods: {
    goBack() {
      this.$backTo("/account/wallet");
    },
    goChannelTransfer(key) {
      //console.log(key);
      this.$router.push({
        path: `/account/${key}`,
        query: { item: base64.encode(JSON.stringify(this.channelInfo)),payType:this.$route.query.payType },
      });
    },
    goBatchTransfer() {
      this.$router.push({
        path: `/account/transfer_batch`,
        query: { item: base64.encode(JSON.stringify(this.channelInfo)),payType:this.$route.query.payType },
      });
    },
  },
};
</script>

<style scoped lang="scss">
.wrapper {
  width: 100%;
  height: 71vh;

  display: flex;
  justify-content: center;
  align-items: center;

  .toplist {
    display: flex;
    justify-content: center;
    .item {
      width: 169px;
      height: 211px;
      border-radius: 10px;
      border: 1px solid #e5e5e5;
      background: #ffffff;
      margin: 0 5px;
      text-align: center;
      cursor: pointer;
      .tit {
        font-size: 14px;
        font-family: PingFangSC-Light, PingFang SC;
        font-weight: 300;
        color: #1d1c1c;
        margin-top: 52px;
      }
      .img {
        margin-top: 34px;
        // max-width: 50px;
        img {
          max-width: 50px;
        }
      }
    }
  }

  .btmlink {
    width: 392px;
    margin: 0 auto;
    margin-top: 70px;

    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #1d1c1c;
    line-height: 20px;
    .batchlink {
      cursor: pointer;
      color: #03bfc6;
    }
  }
}
</style>
